Optimal. Leaf size=56 \[ \frac {a^2 x}{c}-\frac {a^2 \tanh ^{-1}(\sin (e+f x))}{c f}-\frac {4 a^2 \tan (e+f x)}{c f (1-\sec (e+f x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 56, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 6, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3988, 3862, 8,
3879, 3874, 3855} \begin {gather*} -\frac {a^2 \tanh ^{-1}(\sin (e+f x))}{c f}-\frac {4 a^2 \tan (e+f x)}{c f (1-\sec (e+f x))}+\frac {a^2 x}{c} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3855
Rule 3862
Rule 3874
Rule 3879
Rule 3988
Rubi steps
\begin {align*} \int \frac {(a+a \sec (e+f x))^2}{c-c \sec (e+f x)} \, dx &=\frac {\int \left (\frac {a^2}{1-\sec (e+f x)}+\frac {2 a^2 \sec (e+f x)}{1-\sec (e+f x)}+\frac {a^2 \sec ^2(e+f x)}{1-\sec (e+f x)}\right ) \, dx}{c}\\ &=\frac {a^2 \int \frac {1}{1-\sec (e+f x)} \, dx}{c}+\frac {a^2 \int \frac {\sec ^2(e+f x)}{1-\sec (e+f x)} \, dx}{c}+\frac {\left (2 a^2\right ) \int \frac {\sec (e+f x)}{1-\sec (e+f x)} \, dx}{c}\\ &=-\frac {3 a^2 \tan (e+f x)}{c f (1-\sec (e+f x))}-\frac {a^2 \int -1 \, dx}{c}-\frac {a^2 \int \sec (e+f x) \, dx}{c}+\frac {a^2 \int \frac {\sec (e+f x)}{1-\sec (e+f x)} \, dx}{c}\\ &=\frac {a^2 x}{c}-\frac {a^2 \tanh ^{-1}(\sin (e+f x))}{c f}-\frac {4 a^2 \tan (e+f x)}{c f (1-\sec (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(169\) vs. \(2(56)=112\).
time = 0.31, size = 169, normalized size = 3.02 \begin {gather*} \frac {a^2 \csc \left (\frac {e}{2}\right ) \left (-\cos \left (\frac {f x}{2}\right ) \left (f x+\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )+\cos \left (e+\frac {f x}{2}\right ) \left (f x+\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )+8 \sin \left (\frac {f x}{2}\right )\right ) \sin \left (\frac {1}{2} (e+f x)\right )}{c f (-1+\cos (e+f x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 64, normalized size = 1.14
method | result | size |
derivativedivides | \(\frac {4 a^{2} \left (\frac {\ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{4}+\frac {1}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )}+\frac {\arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2}-\frac {\ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{4}\right )}{f c}\) | \(64\) |
default | \(\frac {4 a^{2} \left (\frac {\ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{4}+\frac {1}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )}+\frac {\arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2}-\frac {\ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{4}\right )}{f c}\) | \(64\) |
risch | \(\frac {a^{2} x}{c}+\frac {8 i a^{2}}{f c \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{c f}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{c f}\) | \(82\) |
norman | \(\frac {\frac {a^{2} x \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c}-\frac {4 a^{2}}{c f}+\frac {4 a^{2} \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c f}-\frac {a^{2} x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{c}}{\left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}+\frac {a^{2} \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{c f}-\frac {a^{2} \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{c f}\) | \(145\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 165 vs.
\(2 (57) = 114\).
time = 0.51, size = 165, normalized size = 2.95 \begin {gather*} \frac {a^{2} {\left (\frac {2 \, \arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{c} + \frac {\cos \left (f x + e\right ) + 1}{c \sin \left (f x + e\right )}\right )} - a^{2} {\left (\frac {\log \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + 1\right )}{c} - \frac {\log \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} - 1\right )}{c} - \frac {\cos \left (f x + e\right ) + 1}{c \sin \left (f x + e\right )}\right )} + \frac {2 \, a^{2} {\left (\cos \left (f x + e\right ) + 1\right )}}{c \sin \left (f x + e\right )}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.15, size = 94, normalized size = 1.68 \begin {gather*} \frac {2 \, a^{2} f x \sin \left (f x + e\right ) - a^{2} \log \left (\sin \left (f x + e\right ) + 1\right ) \sin \left (f x + e\right ) + a^{2} \log \left (-\sin \left (f x + e\right ) + 1\right ) \sin \left (f x + e\right ) + 8 \, a^{2} \cos \left (f x + e\right ) + 8 \, a^{2}}{2 \, c f \sin \left (f x + e\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - \frac {a^{2} \left (\int \frac {2 \sec {\left (e + f x \right )}}{\sec {\left (e + f x \right )} - 1}\, dx + \int \frac {\sec ^{2}{\left (e + f x \right )}}{\sec {\left (e + f x \right )} - 1}\, dx + \int \frac {1}{\sec {\left (e + f x \right )} - 1}\, dx\right )}{c} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.50, size = 77, normalized size = 1.38 \begin {gather*} \frac {\frac {{\left (f x + e\right )} a^{2}}{c} - \frac {a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right )}{c} + \frac {a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right )}{c} + \frac {4 \, a^{2}}{c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.48, size = 46, normalized size = 0.82 \begin {gather*} \frac {a^2\,x}{c}-\frac {a^2\,\left (2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )-\frac {4}{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{c\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________